#include<bits/stdc++.h>
using namespace std;
#define ll long long

const ll kmod = 1e9 + 7;
const ll maxn = 1e5 + 10;

ll n, ans, maxa, times,a[maxn], num[maxn];

ll C(ll x, ll k){
	return (k == 1 ? x : x * (x-1) / 2) % kmod;
}

int main()
{   
    cin >> n;
    for(int i = 1; i <= n; i++){
    	cin >> a[i];
    	maxa = max(maxa, a[i]);
    	num[a[i]]++;
	}
	for(int i = 2; i <= maxa; i++){
		if(num[i] >= 2){
		times = C(num[i], 2) % kmod;
		for(int j = 1; j <= i/2; j++){
			if(j != i - j && num[j] >= 1 && num[i-j] >= 1)
			ans += times * C(num[j], 1) * C(num[i-j], 1) % kmod;
			if(j == i - j && num[j] >= 2)
			ans += times * C(num[j], 2) % kmod;
			ans %= kmod;
		}
		} 
	}
	cout << ans << endl;
	return 0;
}
